BINDIR ?= ../
GJS=$(BINDIR)/gcc/gjs1
tests = \
add.bin \
addmul.bin \
base.bin \
for.bin \
func1.bin \
func2.bin \
if.bin \
var-if.bin \
return.bin \
var.bin \
while.bin \
string.bin \
fibo.bin \
string_api.bin \


.PHONY: test
test: $(GJS) $(tests)
$(GJS):

.SUFFIXES: .bin .js
%.bin:%.js
	$(GJS) $< -o $*.s
	$(CC) $*.s -L$(HOME)/lib -lgjs -o $@
	./$@
	DYLD_LIBRARY_PATH= growlnotify -t 'GCC Build' -m 'test Success $@' --image ./img/linux.png

.PHONY: clean
clean:
	-$(RM) -rf ./*.bin ./*.s

bench: $(GJS) fibo.bin
	time -p ./fibo

.PHONY: sputnik
sputnik:
	python ./sputniktests/trunk/tools/sputnik.py --command=gccjs --tests=./sputniktests/trunk --enable-strict-mode


